package cn.selfiot.iotman.help;

import cn.selfiot.iotman.core.I18N;

import java.util.HashMap;
import java.util.Map;
import java.util.ResourceBundle;

/**
 * 帮助信息
 *
 * @author hugo
 * @since 2020/8/7
 */
public class HelpMessage {
    private final static Map<String, String> descMap = new HashMap<>();
    
    static {
        ResourceBundle helpBundle = I18N.getBundle("help");
        // broker
        descMap.put("serverName", helpBundle.getString("serverName"));
        descMap.put("netSecurity", helpBundle.getString("netSecurity"));
        descMap.put("brokerAddr", helpBundle.getString("brokerAddr"));
        descMap.put("brokerPort", helpBundle.getString("brokerPort"));
        
        // conn params
        descMap.put("connectionTimeout", helpBundle.getString("connectionTimeout"));
        descMap.put("keepAlive", helpBundle.getString("keepAlive"));
        descMap.put("cleanSession", helpBundle.getString("cleanSession"));
        descMap.put("reconnection", helpBundle.getString("reconnection"));
        descMap.put("maxInflight", helpBundle.getString("maxInflight"));
        descMap.put("mqttVersion", helpBundle.getString("mqttVersion"));
        
        // user auth
        descMap.put("username", helpBundle.getString("username"));
        descMap.put("password", helpBundle.getString("password"));
        
        //ssl
        descMap.put("sslVer", helpBundle.getString("sslVer"));
        descMap.put("CACertFile", helpBundle.getString("CACertFile"));
        descMap.put("CAKeystore", helpBundle.getString("CAKeystore"));
        descMap.put("CAKeystorePwd", helpBundle.getString("CAKeystorePwd"));
        descMap.put("selfCaCert", helpBundle.getString("selfCaCert"));
        descMap.put("clientCert", helpBundle.getString("clientCert"));
        descMap.put("clientKey", helpBundle.getString("clientKey"));
        descMap.put("clientKeyPwd", helpBundle.getString("clientKeyPwd"));
        descMap.put("pemFormat", helpBundle.getString("pemFormat"));
        
        //lwt
        descMap.put("lwtTopic", helpBundle.getString("lwtTopic"));
        descMap.put("lwtPayload", helpBundle.getString("lwtPayload"));
        descMap.put("lwtQos", helpBundle.getString("lwtQos"));
        descMap.put("lwtRetained", helpBundle.getString("lwtRetained"));
    }
    
    public static String getDesc(String key) {
        return descMap.get(key);
    }
    
    public static void setDesc(String key, String desc) {
        descMap.put(key, desc);
    }
}
